package com.api.shopapi.service.impl;

import com.api.shopapi.entity.JKXueyang;
import com.api.shopapi.entity.dto.JKXueyangDTO;
import com.api.shopapi.mapper.JKXueyangMapper;
import com.api.shopapi.service.JKXueyangServie;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("JKXueyangServieImplOne")
public class JKXueyangServieImpl implements JKXueyangServie {

    @Autowired
    private JKXueyangMapper jkXueyangMapper;

    @Override
    public int insert(JKXueyang jkXueyang) {
        return jkXueyangMapper.insert(jkXueyang);
    }

    @Override
    public int update(JKXueyang jkXueyang) {
        return jkXueyangMapper.update(jkXueyang);
    }

    @Override
    public int delete(String jKXueyangCode) {
        return jkXueyangMapper.delete(jKXueyangCode);
    }

    @Override
    public JKXueyang getByJKXueyangCode(String jKXueyangCode) {
        return jkXueyangMapper.getByJKXueyangCode(jKXueyangCode);
    }

    @Override
    public PageInfo<JKXueyang> getPageList(int pageIndex, int PageSize, String userCode,String startTime,String endTime) {
        PageHelper.startPage(pageIndex,PageSize);
        List<JKXueyang> xueyangList = jkXueyangMapper.getPageList(userCode,startTime,endTime);
        return new PageInfo<>(xueyangList);
    }

    @Override
    public PageInfo<JKXueyangDTO> getAdmPageList(int pageIndex, int pageSize, String name, String governmentCode, String startTime, String endTime) {
        PageHelper.startPage(pageIndex,pageSize);
        List<JKXueyangDTO> jkXueyangDTOList = jkXueyangMapper.getAdmPageList(name, governmentCode, startTime, endTime);
        return new PageInfo<>(jkXueyangDTOList);
    }
}
